<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>SetUtils (Apache Commons Collections 4.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="SetUtils (Apache Commons Collections 4.0 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SetUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/commons/collections4/ResettableListIterator.html" title="interface in org.apache.commons.collections4"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/commons/collections4/SortedBag.html" title="interface in org.apache.commons.collections4"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/commons/collections4/SetUtils.html" target="_top">Frames</a></li>
<li><a href="SetUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.collections4</div>
<h2 title="Class SetUtils" class="title">Class SetUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.collections4.SetUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">SetUtils</span>
extends <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Provides utility methods and decorators for
 <a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><code>Set</code></a> and <a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util"><code>SortedSet</code></a> instances.</div>
<dl><dt><span class="strong">Since:</span></dt>
  <dd>2.1</dd>
<dt><span class="strong">Version:</span></dt>
  <dd>$Id: SetUtils.java 1543964 2013-11-20 21:53:39Z tn $</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#EMPTY_SORTED_SET">EMPTY_SORTED_SET</a></strong></code>
<div class="block">An empty unmodifiable sorted set.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;T&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#emptyIfNull(java.util.Set)">emptyIfNull</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;T&gt;&nbsp;set)</code>
<div class="block">Returns an immutable empty set if the argument is <code>null</code>,
 or the argument itself otherwise.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#emptySet()">emptySet</a></strong>()</code>
<div class="block">Get a typed empty unmodifiable Set.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#emptySortedSet()">emptySortedSet</a></strong>()</code>
<div class="block">Get a typed empty unmodifiable sorted set.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;int</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#hashCodeForSet(java.util.Collection)">hashCodeForSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;T&gt;&nbsp;set)</code>
<div class="block">Generates a hash code using the algorithm specified in
 <a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true#hashCode()" title="class or interface in java.util"><code>Set.hashCode()</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#isEqualSet(java.util.Collection, java.util.Collection)">isEqualSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;?&gt;&nbsp;set1,
          <a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;?&gt;&nbsp;set2)</code>
<div class="block">Tests two sets for equality as per the <code>equals()</code> contract
 in <a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.util"><code>Set.equals(java.lang.Object)</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#orderedSet(java.util.Set)">orderedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set)</code>
<div class="block">Returns a set that maintains the order of elements that are added
 backed by the given set.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#predicatedSet(java.util.Set, org.apache.commons.collections4.Predicate)">predicatedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set,
             <a href="../../../../org/apache/commons/collections4/Predicate.html" title="interface in org.apache.commons.collections4">Predicate</a>&lt;? super E&gt;&nbsp;predicate)</code>
<div class="block">Returns a predicated (validating) set backed by the given set.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#predicatedSortedSet(java.util.SortedSet, org.apache.commons.collections4.Predicate)">predicatedSortedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set,
                   <a href="../../../../org/apache/commons/collections4/Predicate.html" title="interface in org.apache.commons.collections4">Predicate</a>&lt;? super E&gt;&nbsp;predicate)</code>
<div class="block">Returns a predicated (validating) sorted set backed by the given sorted set.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#synchronizedSet(java.util.Set)">synchronizedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set)</code>
<div class="block">Returns a synchronized set backed by the given set.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#synchronizedSortedSet(java.util.SortedSet)">synchronizedSortedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set)</code>
<div class="block">Returns a synchronized sorted set backed by the given sorted set.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#transformedSet(java.util.Set, org.apache.commons.collections4.Transformer)">transformedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set,
              <a href="../../../../org/apache/commons/collections4/Transformer.html" title="interface in org.apache.commons.collections4">Transformer</a>&lt;? super E,? extends E&gt;&nbsp;transformer)</code>
<div class="block">Returns a transformed set backed by the given set.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#transformedSortedSet(java.util.SortedSet, org.apache.commons.collections4.Transformer)">transformedSortedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set,
                    <a href="../../../../org/apache/commons/collections4/Transformer.html" title="interface in org.apache.commons.collections4">Transformer</a>&lt;? super E,? extends E&gt;&nbsp;transformer)</code>
<div class="block">Returns a transformed sorted set backed by the given set.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#unmodifiableSet(java.util.Set)">unmodifiableSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;? extends E&gt;&nbsp;set)</code>
<div class="block">Returns an unmodifiable set backed by the given set.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static &lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/commons/collections4/SetUtils.html#unmodifiableSortedSet(java.util.SortedSet)">unmodifiableSortedSet</a></strong>(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set)</code>
<div class="block">Returns an unmodifiable sorted set backed by the given sorted set.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="EMPTY_SORTED_SET">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>EMPTY_SORTED_SET</h4>
<pre>public static final&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a> EMPTY_SORTED_SET</pre>
<div class="block">An empty unmodifiable sorted set.
 This is not provided in the JDK.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="emptySet()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>emptySet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;emptySet()</pre>
<div class="block">Get a typed empty unmodifiable Set.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd>
<dt><span class="strong">Returns:</span></dt><dd>an empty Set</dd></dl>
</li>
</ul>
<a name="emptySortedSet()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>emptySortedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;emptySortedSet()</pre>
<div class="block">Get a typed empty unmodifiable sorted set.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd>
<dt><span class="strong">Returns:</span></dt><dd>an empty sorted Set</dd></dl>
</li>
</ul>
<a name="emptyIfNull(java.util.Set)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>emptyIfNull</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;T&gt;&nbsp;emptyIfNull(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;T&gt;&nbsp;set)</pre>
<div class="block">Returns an immutable empty set if the argument is <code>null</code>,
 or the argument itself otherwise.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set, possibly <code>null</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>an empty set if the argument is <code>null</code></dd></dl>
</li>
</ul>
<a name="isEqualSet(java.util.Collection, java.util.Collection)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEqualSet</h4>
<pre>public static&nbsp;boolean&nbsp;isEqualSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;?&gt;&nbsp;set1,
                 <a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;?&gt;&nbsp;set2)</pre>
<div class="block">Tests two sets for equality as per the <code>equals()</code> contract
 in <a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.util"><code>Set.equals(java.lang.Object)</code></a>.
 <p>
 This method is useful for implementing <code>Set</code> when you cannot
 extend AbstractSet. The method takes Collection instances to enable other
 collection types to use the Set implementation algorithm.
 <p>
 The relevant text (slightly paraphrased as this is a static method) is:
 <blockquote>
 <p>Two sets are considered equal if they have
 the same size, and every member of the first set is contained in
 the second. This ensures that the <tt>equals</tt> method works
 properly across different implementations of the <tt>Set</tt>
 interface.</p>

 <p>
 This implementation first checks if the two sets are the same object:
 if so it returns <tt>true</tt>.  Then, it checks if the two sets are
 identical in size; if not, it returns false. If so, it returns
 <tt>a.containsAll((Collection) b)</tt>.</p>
 </blockquote></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>set1</code> - the first set, may be null</dd><dd><code>set2</code> - the second set, may be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>whether the sets are equal by value comparison</dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><code>Set</code></a></dd></dl>
</li>
</ul>
<a name="hashCodeForSet(java.util.Collection)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCodeForSet</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;int&nbsp;hashCodeForSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;T&gt;&nbsp;set)</pre>
<div class="block">Generates a hash code using the algorithm specified in
 <a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true#hashCode()" title="class or interface in java.util"><code>Set.hashCode()</code></a>.
 <p>
 This method is useful for implementing <code>Set</code> when you cannot
 extend AbstractSet. The method takes Collection instances to enable other
 collection types to use the Set implementation algorithm.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to calculate the hash code for, may be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>the hash code</dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true#hashCode()" title="class or interface in java.util"><code>Set.hashCode()</code></a></dd></dl>
</li>
</ul>
<a name="synchronizedSet(java.util.Set)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>synchronizedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;synchronizedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set)</pre>
<div class="block">Returns a synchronized set backed by the given set.
 <p>
 You must manually synchronize on the returned set's iterator to
 avoid non-deterministic behavior:

 <pre>
 Set s = SetUtils.synchronizedSet(mySet);
 synchronized (s) {
     Iterator i = s.iterator();
     while (i.hasNext()) {
         process (i.next());
     }
 }
 </pre>

 This method is just a wrapper for <a href="http://download.oracle.com/javase/6/docs/api/java/util/Collections.html?is-external=true#synchronizedSet(java.util.Set)" title="class or interface in java.util"><code>Collections.synchronizedSet(Set)</code></a>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to synchronize, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>a synchronized set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the set is null</dd></dl>
</li>
</ul>
<a name="unmodifiableSet(java.util.Set)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unmodifiableSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;unmodifiableSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;? extends E&gt;&nbsp;set)</pre>
<div class="block">Returns an unmodifiable set backed by the given set.
 <p>
 This method uses the implementation in the decorators subpackage.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to make unmodifiable, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>an unmodifiable set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the set is null</dd></dl>
</li>
</ul>
<a name="predicatedSet(java.util.Set, org.apache.commons.collections4.Predicate)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>predicatedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;predicatedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set,
                       <a href="../../../../org/apache/commons/collections4/Predicate.html" title="interface in org.apache.commons.collections4">Predicate</a>&lt;? super E&gt;&nbsp;predicate)</pre>
<div class="block">Returns a predicated (validating) set backed by the given set.
 <p>
 Only objects that pass the test in the given predicate can be added to the set.
 Trying to add an invalid object results in an IllegalArgumentException.
 It is important not to use the original set after invoking this method,
 as it is a backdoor for adding invalid objects.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to predicate, must not be null</dd><dd><code>predicate</code> - the predicate for the set, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>a predicated set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the Set or Predicate is null</dd></dl>
</li>
</ul>
<a name="transformedSet(java.util.Set, org.apache.commons.collections4.Transformer)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>transformedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;transformedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set,
                        <a href="../../../../org/apache/commons/collections4/Transformer.html" title="interface in org.apache.commons.collections4">Transformer</a>&lt;? super E,? extends E&gt;&nbsp;transformer)</pre>
<div class="block">Returns a transformed set backed by the given set.
 <p>
 Each object is passed through the transformer as it is added to the
 Set. It is important not to use the original set after invoking this
 method, as it is a backdoor for adding untransformed objects.
 <p>
 Existing entries in the specified set will not be transformed.
 If you want that behaviour, see <a href="../../../../org/apache/commons/collections4/set/TransformedSet.html#transformedSet(java.util.Set, org.apache.commons.collections4.Transformer)"><code>TransformedSet.transformedSet(java.util.Set&lt;E&gt;, org.apache.commons.collections4.Transformer&lt;? super E, ? extends E&gt;)</code></a>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to transform, must not be null</dd><dd><code>transformer</code> - the transformer for the set, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>a transformed set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the Set or Transformer is null</dd></dl>
</li>
</ul>
<a name="orderedSet(java.util.Set)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>orderedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;orderedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;E&gt;&nbsp;set)</pre>
<div class="block">Returns a set that maintains the order of elements that are added
 backed by the given set.
 <p>
 If an element is added twice, the order is determined by the first add.
 The order is observed through the iterator or toArray.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to order, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>an ordered set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the Set is null</dd></dl>
</li>
</ul>
<a name="synchronizedSortedSet(java.util.SortedSet)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>synchronizedSortedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;synchronizedSortedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set)</pre>
<div class="block">Returns a synchronized sorted set backed by the given sorted set.
 <p>
 You must manually synchronize on the returned set's iterator to
 avoid non-deterministic behavior:

 <pre>
 Set s = SetUtils.synchronizedSet(mySet);
 synchronized (s) {
     Iterator i = s.iterator();
     while (i.hasNext()) {
         process (i.next());
     }
 }
 </pre>

 This method is just a wrapper for <a href="http://download.oracle.com/javase/6/docs/api/java/util/Collections.html?is-external=true#synchronizedSortedSet(java.util.SortedSet)" title="class or interface in java.util"><code>Collections.synchronizedSortedSet(SortedSet)</code></a>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the sorted set to synchronize, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>a synchronized set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the set is null</dd></dl>
</li>
</ul>
<a name="unmodifiableSortedSet(java.util.SortedSet)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unmodifiableSortedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;unmodifiableSortedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set)</pre>
<div class="block">Returns an unmodifiable sorted set backed by the given sorted set.
 <p>
 This method uses the implementation in the decorators subpackage.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the sorted set to make unmodifiable, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>an unmodifiable set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the set is null</dd></dl>
</li>
</ul>
<a name="predicatedSortedSet(java.util.SortedSet, org.apache.commons.collections4.Predicate)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>predicatedSortedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;predicatedSortedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set,
                                   <a href="../../../../org/apache/commons/collections4/Predicate.html" title="interface in org.apache.commons.collections4">Predicate</a>&lt;? super E&gt;&nbsp;predicate)</pre>
<div class="block">Returns a predicated (validating) sorted set backed by the given sorted set.
 <p>
 Only objects that pass the test in the given predicate can be added to the set.
 Trying to add an invalid object results in an IllegalArgumentException.
 It is important not to use the original set after invoking this method,
 as it is a backdoor for adding invalid objects.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the sorted set to predicate, must not be null</dd><dd><code>predicate</code> - the predicate for the sorted set, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>a predicated sorted set backed by the given sorted set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the Set or Predicate is null</dd></dl>
</li>
</ul>
<a name="transformedSortedSet(java.util.SortedSet, org.apache.commons.collections4.Transformer)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>transformedSortedSet</h4>
<pre>public static&nbsp;&lt;E&gt;&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;transformedSortedSet(<a href="http://download.oracle.com/javase/6/docs/api/java/util/SortedSet.html?is-external=true" title="class or interface in java.util">SortedSet</a>&lt;E&gt;&nbsp;set,
                                    <a href="../../../../org/apache/commons/collections4/Transformer.html" title="interface in org.apache.commons.collections4">Transformer</a>&lt;? super E,? extends E&gt;&nbsp;transformer)</pre>
<div class="block">Returns a transformed sorted set backed by the given set.
 <p>
 Each object is passed through the transformer as it is added to the
 Set. It is important not to use the original set after invoking this
 method, as it is a backdoor for adding untransformed objects.
 <p>
 Existing entries in the specified set will not be transformed.
 If you want that behaviour, see <a href="../../../../org/apache/commons/collections4/set/TransformedSortedSet.html#transformedSortedSet(java.util.SortedSet, org.apache.commons.collections4.Transformer)"><code>TransformedSortedSet.transformedSortedSet(java.util.SortedSet&lt;E&gt;, org.apache.commons.collections4.Transformer&lt;? super E, ? extends E&gt;)</code></a>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>E</code> - the element type</dd><dt><span class="strong">Parameters:</span></dt><dd><code>set</code> - the set to transform, must not be null</dd><dd><code>transformer</code> - the transformer for the set, must not be null</dd>
<dt><span class="strong">Returns:</span></dt><dd>a transformed set backed by the given set</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the Set or Transformer is null</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SetUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/commons/collections4/ResettableListIterator.html" title="interface in org.apache.commons.collections4"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/commons/collections4/SortedBag.html" title="interface in org.apache.commons.collections4"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/commons/collections4/SetUtils.html" target="_top">Frames</a></li>
<li><a href="SetUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
